package com.xkdx.caipiao.presistence.jifen;

import java.util.ArrayList;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xkdx.caipiao.module.network.AbsModule;

public class JifenModule extends AbsModule {
	public ArrayList<JifenInfo> list;

	@Override
	public void parseData() throws Exception {
		try {
			backJson = (JSONArray) result;
			list = new ArrayList<JifenInfo>();
			for (int i = 0; i < backJson.size(); i++) {
				jsonObj = (JSONObject) backJson.get(i);
				String sortOfAct = jsonObj.getString("Act");
				if (sortOfAct.equals("ScoreLog")) {
					parseJifen(jsonObj.getJSONArray("DetailInfo"));
				}

			}
		} catch (Exception e) {
			throw e;
		}

	}

	private void parseJifen(JSONArray jsonArray) throws Exception {
		try {

			JSONArray array = jsonArray;
			for (int i = 0; i < array.size(); i++) {

				JSONObject obj = array.getJSONObject(i);
				JifenInfo jifenInfo = new JifenInfo();
				jifenInfo.setCoin(obj.getString("coin"));
				jifenInfo.setCtime(obj.getString("ctime"));
				jifenInfo.setDesc(obj.getString("desc"));
				jifenInfo.setId(obj.getString("id"));
				jifenInfo.setMoney(obj.getString("money"));
				jifenInfo.setOrderid(obj.getString("orderid"));
				jifenInfo.setPayway(obj.getString("payway"));
				jifenInfo.setType(obj.getString("type"));
				jifenInfo.setUid(obj.getString("uid"));
				jifenInfo.setUser_login_name(obj.getString("user_login_name"));
				list.add(jifenInfo);
			}

		} catch (Exception e) {

			throw e;
		}
	}
}
